package com.crm.service.impl.csd.customerManager;

import com.crm.dao.mapper.csd.customerManager.CustomerServiceWorkLogMapper;
import com.crm.dao.mapper.customMapper.csd.CustomerServiceWorkLogCustomMapper;
import com.crm.model.entity.csd.customerManager.CustomerServiceWorkLog;
import com.crm.model.vo.csd.customerManager.CustomerServiceWorkLogVO;
import com.crm.service.csd.customerManager.CustomerServiceWorkLogDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yincuimei
 * @Date 2021/8/18 15:00
 * (客服部)工作日志->针对客户的一系列操作记录工作日志
 */
@Service
public class CustomerServiceWorkLogDbServiceImpl implements CustomerServiceWorkLogDbService {
    @Autowired
    private CustomerServiceWorkLogCustomMapper workLogCustomMapper;
    @Autowired
    private CustomerServiceWorkLogMapper customerServiceWorkLogMapper;

    /**
     * (客服部)工作日志列表--根据客户ID查询工作日志
     * @param customerId --客户ID
     * @param orderStr   --排序
     * @author yincuimei
     * @return
     */
    @Override
    public List<CustomerServiceWorkLogVO> selectWorkLogList(String customerId,String orderStr) {
        return workLogCustomMapper.selectWorkLogVOList(customerId,orderStr);
    }

    /**
     * 工作日志--查看
     * @param workLogId --日志主键
     * @return
     */
    @Override
    public CustomerServiceWorkLogVO selectWorkLogById(String workLogId) {
        return workLogCustomMapper.selectWorkLogVOById(workLogId);
    }

    /**
     * (客服部)批量新增工作日志
     * @param customerServiceWorkLogList --工作日志集合
     * @return
     */
    @Override
    public Boolean insertWorkLogBatch(List<CustomerServiceWorkLog> customerServiceWorkLogList) {
        return workLogCustomMapper.insertWorkLogBatch(customerServiceWorkLogList) > 0;
    }

    /**
     * (客服部)新增工作日志
     * @param customerServiceWorkLog --工作日志实体
     * @author yincuimei
     * @return
     */
    @Override
    public Boolean insertWorkLog(CustomerServiceWorkLog customerServiceWorkLog) {
        return customerServiceWorkLogMapper.insertSelective(customerServiceWorkLog) > 0;
    }

    /**
     * (客服部)工作日志--修改备注、上传附件
     * @param workLog
     * @return
     */
    @Override
    public Boolean updateWorkLogById(CustomerServiceWorkLog workLog) {
        return customerServiceWorkLogMapper.updateByPrimaryKeySelective(workLog) > 0;
    }
}
